import axios from '@/utils/request';

/**
 * 查询今日数据
 */
export async function QueryTodayDataAnalysisByCondition(params) {
  const res = await axios.post('/Home/QueryTodayDataAnalysisByCondition', params);
  if (res.data.code === 200) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.msg));
}

/**
 * 查询消息列表
 */
export async function QueryMessageByCondition(params) {
  const res = await axios.post('/Home/QueryMessageByCondition', params);
  if (res.data.code === 200) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.msg));
}

/**
 * 查询订单趋势
 */
export async function QueryOrderSaleAnalysisByCondition(params) {
  const res = await axios.post('/Home/QueryOrderSaleAnalysisByCondition', params);
  if (res.data.code === 200) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.msg));
}

/**
 * 查询销售列表
 */
export async function QueryProductSaleAnalysisByCondition(params) {
  const res = await axios.post('/Home/QueryProductSaleAnalysisByCondition', params);
  if (res.data.code === 200) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.msg));
}
